package com.example.downloader.upload2;

import android.view.View;

public abstract class Callback<R> {
    private Task<R> mTask;

    void attachTask(Task<R> task) {
        mTask = task;
    }

    void detachTask() {
        mTask = null;
    }


    Task<R> getTask() {
        return mTask;
    }


    final int id;

    public Callback(View view) {
        id = view.hashCode();
    }

    public abstract void onWaiting();

    public abstract void onCompressing();

    public abstract void onUploading(int progress);

    public abstract void onFinished(R result);

    public abstract void onError();

    public abstract void onCancel();


    int getId() {
        return id;
    }
}
